<template>
  <div>
    <curd-title required :title="'供应商信息'" />
    <avue-crud
      ref="crud"
      :option="option"
      :data="data"
      @row-save="rowSave"
      @row-click="handleRowClick"
      @selection-change="selectionChange"
    >
    <el-button type="primary" slot="menuLeft" @click="deleteGroup">批量删除</el-button>
    </avue-crud>
  </div>
</template>

<script>
import CurdTitle from '@/components/base/title'
import { option } from '@/option/tenant/supplier/classify-info'
export default {
  name: 'ClassifyInfo',
  components: { CurdTitle },
  data() {
    return {
      data:[],
      option:option.call(this),
      column: {},
      checkIndex: []
    }
  },
  methdos: {
    rowSave(form, done) {
      this.$message.success('新增数据' + JSON.stringify(form))
      done()
    },
    // handleCell(row, index) {
    //   this.column = row
    //   this.$refs.crud.rowCell(row, index)
    // },
    handleRowClick(row, event, column) {
      this.column = row
      this.$refs.crud.rowCell(row, row.$index)
    },
    selectionChange(row) {
      this.checkIndex = row.map(v => v.$index)
    },
    deleteGroup(){
      this.data = this.data.filter(item => !(this.checkIndex.includes(item.$index)))
    }
  }
}
</script>

<style></style>
